<html>
  <head>
	<meta http-equiv="content-type" content="text/html; charset=UTF-8">
	<title></title>
  </head>
  <body>
	<script type="text/javascript" src="../../../../lib/dojo/dojo/dojo.js.uncompressed.js"
		djConfig="isDebug: true, debugAtAllCosts: true, parseOnLoad: false, usePlainJson: true"></script>
	<script type="text/javascript">
		dojo.registerModulePath("rforms","../../../src/rforms");
		dojo.registerModulePath("rdfjson","../../../src/rdfjson");
		dojo.require("rforms.model.Engine");
		dojo.require("rforms.model.GroupBinding");
		dojo.require("rforms.model.PropertyGroupBinding");
		dojo.require("rforms.model.ValueBinding");
		dojo.require("rforms.template.ItemStore");
		dojo.require("rdfjson.Graph");
		dojo.require("rdfjson.tests.data");
		dojo.require("rforms.template.tests.data");

		dojo.addOnLoad(function() {
			var doh = {};
			doh.t = function(val) {
				if (!val) {
					alert("doh error");
				}
			};
			doh.f = function(val) {
				if (val) {
					alert("doh error");
				} 
			};
			debugger;

			//Paste code from the tests below (within start and end mark) to be able to debug them,
			//remove any use of doh to allow independent debugging.
			//-------------------------START----------------------------------------

			this.graph = new rdfjson.Graph({});
	this.s1 = this.graph.create(rdfjson.tests.uris[0], rdfjson.tests.predicates[0]);
	this.s2 = this.graph.create(rdfjson.tests.uris[0], rdfjson.tests.predicates[1], {"type": "literal", "value": "Hepp"});
	this.is = new rforms.template.ItemStore();
	this.t1 = this.is.createTemplate(rforms.template.tests.template1);
	this.b1 = new rforms.model.GroupBinding({item: this.t1.getRoot()});
	this.b2 = new rforms.model.ValueBinding({item: this.t1.getRoot().getChildren()[1], statement: this.s2});
		doh.t(this.b1.getChildBindings().length === 0);
		this.b1.addChildBinding(this.b2);
		doh.t(this.b1.getChildBindings().length === 1);
		this.b1.removeChildBinding(this.b2);
		doh.t(this.b1.getChildBindings().length === 0);
			//-------------------------END----------------------------------------
			console.log("A sensless log entry, to be able to step over last code row in firebug above.")
		});
	</script>
  </body>
</html>
